Public Class CustomerContactControl
    Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents txtName As System.Web.UI.WebControls.TextBox
    Protected WithEvents reqvName As System.Web.UI.WebControls.RequiredFieldValidator
    Protected WithEvents lblHeader As System.Web.UI.WebControls.Label
    Protected WithEvents ValidationSummary1 As System.Web.UI.WebControls.ValidationSummary
    Protected WithEvents RegularExpressionValidator1 As System.Web.UI.WebControls.RegularExpressionValidator

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

#Region "   Properties"
    Public Property PageBOSessionName() As String
        Get
            Return CStr(ViewState("PageBOSessionName"))
        End Get
        Set(ByVal Value As String)
            ViewState("PageBOSessionName") = Value
        End Set
    End Property


    Protected ReadOnly Property PageBO() As CCustomerContact
        Get
            Return CType(Session(Me.PageBOSessionName), CCustomerContact)
        End Get
    End Property

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Not Page.IsPostBack Then
            Me.DataBind()

            If PageBO.ID > 0 Then
                Me.lblHeader.Text = "Update customer contact"
            Else
                Me.lblHeader.Text = "New customer contact"
            End If

            Page.RegisterStartupScript("focus", String.Format("<script>window.document.getElementById('{0}').focus();</script>", Me.txtName.ClientID))

        End If
    End Sub

    Private Sub txtName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtName.TextChanged
        PageBO.ContactName = txtName.Text
    End Sub
End Class
